package com.android.panballgame;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class PBRankRegister extends Activity{
	private WebView webView;

	@Override
	@SuppressLint("SetJavaScriptEnabled")
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.webview);
		
		String nickname = getIntent().getStringExtra("nickname"); //Ranking엑티비티에서 받아온 닉네임 값 저장
		webView = (WebView) this.findViewById(R.id.webview);
		
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
		
		webView.setWebViewClient(new WebViewClient(){
			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon){
				super.onPageStarted(view, url, favicon);				
				setProgressBarIndeterminateVisibility(true);
			}
			
			@Override
			public void onPageFinished(WebView view, String url){
				super.onPageFinished(view, url);				
				setProgressBarIndeterminateVisibility(false);
			}
		});
		PBEngine.dbtime = (int) (PBEngine.dbtime * (-0.001));
		webView.loadUrl("http://192.168.43.74:8080/PBGServer/WebServer.jsp?name="+ nickname +"&time=" + PBEngine.dbtime);
		webView.setVisibility(webView.GONE);
		finish();
	}
}